#include "mystdio.h"
#include <string.h>
#include <unistd.h>

const char* filename = "./log.txt";

int main()
{
  myFILE *fp = my_fopen(filename,"w");
  if(fp == NULL)
  {
    return 1;
  }

  //file operator
  //const char* s = "hello stdio!\n";//行刷新

  int cnt = 5;
  char buffer[64];
  while(cnt--)
  {
    snprintf(buffer,sizeof(buffer),"hello world,%d  ",cnt);
    my_fwrite(fp,buffer,strlen(buffer));
    DebugPrint(fp);
    sleep(2);
    //my_fflush(fp);
  }
  fork();

  my_fclose(fp);
  return 0;

}
